/*	This program produces Table C1 */

***** Set directories 
local dir_clean 	"~/Dropbox/Retirement gaming/clean"
local dir_output 	"~/Dropbox/Retirement gaming/output/dataverse"


use "`dir_clean'/mainsample_medbcw.dta", clear

* Sets of controls		
local listcontrols1 = " i.t  " 
local listcontrols2 = " i.t i.ciiu2_1stobs i.ndep_cat_1stobs i.ndep_cat " 
local listcontrols3 = " i.t i.ciiu2_1stobs i.ndep_cat_1stobs i.ndep_cat i.year#i.i.ciiu2_1stobs i.year#i.ndep_cat_1stobs "  


estimates clear
* Reports MCB
foreach c in  1 2 3 {
		preserve
		keep if  self_empl==1  & ficto_1stobs==1 
		*Normalize wages
		sum W if time_bcw==-1
		local meanw=r(mean)
		g Wz=W/`meanw'		
		* Regress
		eststo: reghdfe Wz pre6 pre25 post03 post4, absorb(`listcontrols`c'') vce(cluster i ) 
		restore
	}
* Reports more than MCB
foreach c in  1 2 3 {
		preserve
		keep if  self_empl==1  & ficto_1stobs==0
		*Normalize wages
		sum W if time_bcw==-1
		local meanw=r(mean)
		g Wz=W/`meanw'		
		* Regress
		eststo: reghdfe Wz pre6 pre25 post03 post4, absorb(`listcontrols`c'') vce(cluster i ) 
		restore
	}
* Table with results 
esttab using "`dir_output'/tableC1.tex", ///
	keep(pre25 post03 post4)  noobs  ///
	stats(N N_clust1, label("Observations" "Individuals") fmt(%9.0gc)) prefoot(\hline) ///
	b(%4.3f) se(%4.3f) star(* 0.10 ** 0.05 *** 0.01) ///
	f nomtitles  nogaps replace label  nonumbers nolines


clear all
exit
 
